import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

/// 获取 AppBar
/// @param context 上下文
/// @param title 标题
/// @param backgroundColor 标题栏颜色
/// @param foregroundColor 标题栏文案颜色
PreferredSizeWidget getAppBar({
  required BuildContext context,
  required String title,
  Color? backgroundColor,
  Color? foregroundColor,
}) {
  return AppBar(
    title: Text(title),
    centerTitle: true,
    backgroundColor: backgroundColor ?? Colors.blue,
    foregroundColor: foregroundColor ?? Colors.white,
  );
}
